package datacrawl.test;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

import com.kinth.work.webmagic.huicong.JSUtil;

public class HuiCongTest3
{

	public static void main(String[] args)
	{
		String qq = "TypeError: Attempting to configurable attribute of unconfigurable property. "
				+ " http://dn-growing.qbox.me/vds.js:2 in defineProperty  http://dn-growing."
				+ "qbox.me/vds.js:2 in registerHistoryHandler  http://dn-growing.qbox.me/vds."
				+ "js:2 in domLoadedHandler  http://dn-growing.qbox.me/vds.js:2 in observe "
				+ " http://dn-growing.qbox.me/vds.js:2 in s  http://dn-growing.qbox.me/vds.j"
				+ "s:2 in connect  http://dn-growing.qbox.me/vds.js:3 in connect  http://dn"
				+ "-growing.qbox.me/vds.js:2  http://dn-growing.qbox.me/vds.js:1 in i  "
				+ "http://dn-growing.qbox.me/vds.js:1 in t<p class='current'>在线客服</p><ul>"
						+ "<li><span>zhixing116688</span><a href='http://wpa.qq.com/msgrd?"
						+ "v=3&amp;uin=3286826833&amp;site=qq&amp;menu=yes' target='_blank'"
						+ " onmousedown='HC.UBA.sendUserlogsElement('UserBehavior_detail_qq_f"
						+ "loat_free_1?detailuserid=100019872065')'><em></em></a></li></ul>"
						+ "<div class='fafa'><a data-bcid='' onmousedown='HC.UBA.sendUserlo"
						+ "gsElement('UserBehavior_detail_fafa_float_free_1?detailuserid="
						+ "100019872065')";
		String s ="abc<a bb hre >rrrr";
		String s2 = "sss<a href='http://wpa.qq.com/msgrd?"
						+ "v=3&amp;uin=3286826833&amp;site=qq&amp;menu=yes' target='_blank'"
						+ " onmousedown='HC.UBA.sendUserlogsElement('UserBehavior_detail_qq_f"
						+ "loat_free_1?detailuserid=100019872065')'>";
		//System.out.println("测试qq: "+qq);
		//<a.*?href="(.*?)">(.*?)</a>
		//Pattern p = Pattern.compile(".*?(<a[^>]+?href=[\"']?([^\"']+)[\"']?[^>]*>([^<]+)</a>).*?");
		//Matcher m = p.matcher(s);
		//<a[^>]*href=(\"([^\"]*)\"|\'([^\']*)\'|([^\\s>]*))[^>]*>(.*?)</a>
		//Matcher m = p.matcher(qq);
		
		
		   String regex;
		     
		     regex = "<a[\\s\\S]*?>";
		     Pattern pa = Pattern.compile(regex, Pattern.DOTALL);
		     Matcher ma = pa.matcher(qq);
		     while (ma.find())
		     {
		      System.out.println("测试5： "+ma.group(0));
		     }
		
		
//		Pattern p = Pattern.compile("a*b");
//		 Matcher m = p.matcher("aaaaab");
//		 boolean b = m.matches();
//		System.out.println("测试qq3: "+b);
//		if(m != null )
//		{
//			//System.out.println("测试4： "+m.matches());
//			qq = m.group(0);
//			System.out.println("测试qq2： "+qq);
//		}else
//		{
//			System.out.println("测试qq3: m为空");
//		}
	}
}
